
#!/bin/bash
#Log颜色处理-------------start
function infolog(){
    echo -e Log: "\033[32m$1\033[0m"
}

#输出报错log
function errorlog(){
    echo -e Error: "\033[01;31m$1\033[0m"
}

#输出报错log并停止运行
function errorlogExit(){
    echo -e Error: "\033[01;31m$1\033[0m"
    echo -e Error: "\033[01;31m打包失败\033[0m"
    exit
}

###获取当前脚步路径......
_CPath=$(pwd)
#echo "scriptPath1: "$(cd `dirname $0`; pwd)
#echo "scriptPath2: "$(pwd)
#echo "scriptPath4: "$(cd $(dirname ${BASH_SOURCE:-$0});pwd)

###获取当前时间......
_SDate=$(date +%Y.%m.%d_%H.%M.%S)



fileName=$1
echo fileName,,.....${fileName}
sourcePath=$2
echo sourcePath,,.....${sourcePath}


#fileName="com.xinyu.mmmm.sh"
#sourcePath="/Users/xia9000/work/run_app2build.sh"

macShareD="/Volumes/VMware Shared Folders/macShareD"
echo "进入路径。。${macShareD}"
cd "${macShareD}"

pwd
#本地上传目录
#targetDir="/Volumes/VMware Shared Folders/macShareD/appUploadDNS/"

appUploadDNS="appUploadDNS/"
targetFilePath="${appUploadDNS}${fileName}"

 
 
echo "目录检查。。。"
if [ ! -f ${appUploadDNS} ];then
    echo "创建文件夹...... mkdir -p ${appUploadDNS}"
    #echo "1122" | sudo -S mkdir -p ${appUploadDNS}   #不存在的文件夹要创建
    mkdir -p "${appUploadDNS}"   #不存在的文件夹要创建
else
    echo "#文件夹存在...${appUploadDNS}"
    if [ -f ${targetFilePath} ];then
        echo "#文件存在，删除文件.....${targetFilePath}"
        #echo "1122" | sudo -S rm -rf ${targetFilePath}
        rm -rf ${targetFilePath}
    fi
fi


 

cp -f ${sourcePath} ${targetFilePath}
 

 
